package com.dragon.modules.yuegou.query.product;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dragon.modules.yuegou.entity.product.CoupApplyEntity;
import com.dragon.modules.yuegou.enums.product.CoupApplyCheckedStatus;
import com.dragon.modules.yuegou.enums.product.CoupApplyGrantType;
import com.dragon.modules.yuegou.mybatis.Condition;
import com.dragon.modules.yuegou.mybatis.Query;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonUnwrapped;

import java.time.LocalDateTime;

/**
 * 商品券申请表 动态查询条件
 *
 * @author pbuilder generated
 * @date 2021-05-14 16:13:49
 * @version 2.0
 */
@JsonInclude(Include.NON_NULL)
public class CoupApplyQuery extends CoupApplyEntity implements Query<CoupApplyEntity> {

	/** ID查询条件 */
	@JsonUnwrapped(prefix = "id")
	private Condition<String> idCondition;

	/** 券ID查询条件 */
	@JsonUnwrapped(prefix = "coupTemplateId")
	private Condition<String> coupTemplateIdCondition;

	/** [枚举]发放形式：0-二维码-QR查询条件 */
	@JsonUnwrapped(prefix = "grantType")
	private Condition<CoupApplyGrantType> grantTypeCondition;

	/** 商户id查询条件 */
	@JsonUnwrapped(prefix = "merchantId")
	private Condition<String> merchantIdCondition;

	/** 申请数量查询条件 */
	@JsonUnwrapped(prefix = "applyQuantity")
	private Condition<Integer> applyQuantityCondition;

	/** 审核数量查询条件 */
	@JsonUnwrapped(prefix = "checkQuantity")
	private Condition<Integer> checkQuantityCondition;

	/** 发放数量查询条件 */
	@JsonUnwrapped(prefix = "releasedQuantity")
	private Condition<Integer> releasedQuantityCondition;

	/** 申请有效日期开始查询条件 */
	@JsonUnwrapped(prefix = "startTime")
	private Condition<LocalDateTime> startTimeCondition;

	/** 申请有效日期结束查询条件 */
	@JsonUnwrapped(prefix = "endTime")
	private Condition<LocalDateTime> endTimeCondition;

	/** [枚举]审核状态：0-未审核-READY、1-审核中-CHECKING、2-已通过-PASSED、3-审核未通过-UNPASSED、5-已失效-INVALID查询条件 */
	@JsonUnwrapped(prefix = "checkedStatus")
	private Condition<CoupApplyCheckedStatus> checkedStatusCondition;

	/** 审核有效日期开始查询条件 */
	@JsonUnwrapped(prefix = "checkStartTime")
	private Condition<LocalDateTime> checkStartTimeCondition;

	/** 审核有效日期结束查询条件 */
	@JsonUnwrapped(prefix = "checkEndTime")
	private Condition<LocalDateTime> checkEndTimeCondition;

	/** 版本查询条件 */
	@JsonUnwrapped(prefix = "version")
	private Condition<Integer> versionCondition;

	/** 创建时间查询条件 */
	@JsonUnwrapped(prefix = "createdTime")
	private Condition<LocalDateTime> createdTimeCondition;

	/** 查询条件 */
	@JsonUnwrapped(prefix = "createdBy")
	private Condition<String> createdByCondition;

	/** 是否删除（1：已删除，0：未删除）查询条件 */
	@JsonUnwrapped(prefix = "del")
	private Condition<Boolean> delCondition;

	/** 删除时间查询条件 */
	@JsonUnwrapped(prefix = "delTime")
	private Condition<LocalDateTime> delTimeCondition;

	/**
	 * 构造一个查询条件对象
	 */
	public CoupApplyQuery() {
		super();
	}

	/**
	 * 依据实体对象构造一个查询条件对象
	 *
	 * @param entity 实体对象
	 */
	public CoupApplyQuery(CoupApplyEntity entity) {
		super(entity);
	}

	/**
	 * 依据其它查询条件对象的信息构造一个查询条件对象
	 *
	 * @param other 查询条件对象
	 */
	public CoupApplyQuery(CoupApplyQuery other) {
		super(other);
		if (other.idCondition != null) {
			this.idCondition = other.idCondition.copy();
		}
		if (other.coupTemplateIdCondition != null) {
			this.coupTemplateIdCondition = other.coupTemplateIdCondition.copy();
		}
		if (other.grantTypeCondition != null) {
			this.grantTypeCondition = other.grantTypeCondition.copy();
		}
		if (other.merchantIdCondition != null) {
			this.merchantIdCondition = other.merchantIdCondition.copy();
		}
		if (other.applyQuantityCondition != null) {
			this.applyQuantityCondition = other.applyQuantityCondition.copy();
		}
		if (other.checkQuantityCondition != null) {
			this.checkQuantityCondition = other.checkQuantityCondition.copy();
		}
		if (other.releasedQuantityCondition != null) {
			this.releasedQuantityCondition = other.releasedQuantityCondition.copy();
		}
		if (other.startTimeCondition != null) {
			this.startTimeCondition = other.startTimeCondition.copy();
		}
		if (other.endTimeCondition != null) {
			this.endTimeCondition = other.endTimeCondition.copy();
		}
		if (other.checkedStatusCondition != null) {
			this.checkedStatusCondition = other.checkedStatusCondition.copy();
		}
		if (other.checkStartTimeCondition != null) {
			this.checkStartTimeCondition = other.checkStartTimeCondition.copy();
		}
		if (other.checkEndTimeCondition != null) {
			this.checkEndTimeCondition = other.checkEndTimeCondition.copy();
		}
		if (other.versionCondition != null) {
			this.versionCondition = other.versionCondition.copy();
		}
		this.setOther(other);
	}

	private void setOther(CoupApplyQuery other){
		if(other.createdTimeCondition != null) {
			this.createdTimeCondition = other.createdTimeCondition.copy();
		}
		if(other.createdByCondition != null) {
			this.createdByCondition = other.createdByCondition.copy();
		}
		if(other.delCondition != null) {
			this.delCondition = other.delCondition.copy();
		}
		if(other.delTimeCondition != null) {
			this.delTimeCondition = other.delTimeCondition.copy();
		}
	}

	@Override
	public QueryWrapper<CoupApplyEntity> toQueryWrapper() {
		QueryWrapper<CoupApplyEntity> wrapper = new QueryWrapper<>(this);
		if (idCondition != null) {
			idCondition.toWrapper(wrapper, COL_ID);
		}
		if (coupTemplateIdCondition != null) {
			coupTemplateIdCondition.toWrapper(wrapper, COL_COUP_TEMPLATE_ID);
		}
		if (grantTypeCondition != null) {
			grantTypeCondition.toWrapper(wrapper, COL_GRANT_TYPE);
		}
		if (merchantIdCondition != null) {
			merchantIdCondition.toWrapper(wrapper, COL_MERCHANT_ID);
		}
		if (applyQuantityCondition != null) {
			applyQuantityCondition.toWrapper(wrapper, COL_APPLY_QUANTITY);
		}
		if (checkQuantityCondition != null) {
			checkQuantityCondition.toWrapper(wrapper, COL_CHECK_QUANTITY);
		}
		if (releasedQuantityCondition != null) {
			releasedQuantityCondition.toWrapper(wrapper, COL_RELEASED_QUANTITY);
		}
		if (startTimeCondition != null) {
			startTimeCondition.toWrapper(wrapper, COL_START_TIME);
		}
		if (endTimeCondition != null) {
			endTimeCondition.toWrapper(wrapper, COL_END_TIME);
		}
		if (checkedStatusCondition != null) {
			checkedStatusCondition.toWrapper(wrapper, COL_CHECKED_STATUS);
		}
		if (checkStartTimeCondition != null) {
			checkStartTimeCondition.toWrapper(wrapper, COL_CHECK_START_TIME);
		}
		if (checkEndTimeCondition != null) {
			checkEndTimeCondition.toWrapper(wrapper, COL_CHECK_END_TIME);
		}
		if (versionCondition != null) {
			versionCondition.toWrapper(wrapper, COL_VERSION);
		}
		return getQueryWrapper(wrapper);
	}

	private QueryWrapper<CoupApplyEntity> getQueryWrapper(QueryWrapper<CoupApplyEntity> wrapper){
		if (createdTimeCondition != null) {
			createdTimeCondition.toWrapper(wrapper, COL_CREATED_TIME);
		}
		if (createdByCondition != null) {
			createdByCondition.toWrapper(wrapper, COL_CREATED_BY);
		}
		if (delCondition != null) {
			delCondition.toWrapper(wrapper, COL_DEL);
		}
		if (delTimeCondition != null) {
			delTimeCondition.toWrapper(wrapper, COL_DEL_TIME);
		}
		return wrapper;
	}

	/**
	 * 构造并返回ID查询条件
	 *
	 * @return idCondition ID查询条件
	 */
	public Condition<String> id() {
		this.idCondition = new Condition<>();
		return this.idCondition;
	}

	/**
	 * 获取ID查询条件
	 *
	 * @return idCondition ID查询条件
	 */
	public Condition<String> getIdCondition() {
		return idCondition;
	}

	/**
	 * 设置ID查询条件
	 *
	 * @param idCondition ID查询条件
	 */
	public void setIdCondition(Condition<String> idCondition) {
		this.idCondition = idCondition;
	}

	/**
	 * 构造并返回券ID查询条件
	 *
	 * @return coupTemplateIdCondition 券ID查询条件
	 */
	public Condition<String> coupTemplateId() {
		this.coupTemplateIdCondition = new Condition<>();
		return this.coupTemplateIdCondition;
	}

	/**
	 * 获取券ID查询条件
	 *
	 * @return coupTemplateIdCondition 券ID查询条件
	 */
	public Condition<String> getCoupTemplateIdCondition() {
		return coupTemplateIdCondition;
	}

	/**
	 * 设置券ID查询条件
	 *
	 * @param coupTemplateIdCondition 券ID查询条件
	 */
	public void setCoupTemplateIdCondition(Condition<String> coupTemplateIdCondition) {
		this.coupTemplateIdCondition = coupTemplateIdCondition;
	}

	/**
	 * 构造并返回[枚举]发放形式：0-二维码-QR查询条件
	 *
	 * @return grantTypeCondition [枚举]发放形式：0-二维码-QR查询条件
	 */
	public Condition<CoupApplyGrantType> grantType() {
		this.grantTypeCondition = new Condition<>();
		return this.grantTypeCondition;
	}

	/**
	 * 获取[枚举]发放形式：0-二维码-QR查询条件
	 *
	 * @return grantTypeCondition [枚举]发放形式：0-二维码-QR查询条件
	 */
	public Condition<CoupApplyGrantType> getGrantTypeCondition() {
		return grantTypeCondition;
	}

	/**
	 * 设置[枚举]发放形式：0-二维码-QR查询条件
	 *
	 * @param grantTypeCondition [枚举]发放形式：0-二维码-QR查询条件
	 */
	public void setGrantTypeCondition(Condition<CoupApplyGrantType> grantTypeCondition) {
		this.grantTypeCondition = grantTypeCondition;
	}

	/**
	 * 构造并返回商户id查询条件
	 *
	 * @return merchantIdCondition 商户id查询条件
	 */
	public Condition<String> merchantId() {
		this.merchantIdCondition = new Condition<>();
		return this.merchantIdCondition;
	}

	/**
	 * 获取商户id查询条件
	 *
	 * @return merchantIdCondition 商户id查询条件
	 */
	public Condition<String> getMerchantIdCondition() {
		return merchantIdCondition;
	}

	/**
	 * 设置商户id查询条件
	 *
	 * @param merchantIdCondition 商户id查询条件
	 */
	public void setMerchantIdCondition(Condition<String> merchantIdCondition) {
		this.merchantIdCondition = merchantIdCondition;
	}

	/**
	 * 构造并返回申请数量查询条件
	 *
	 * @return applyQuantityCondition 申请数量查询条件
	 */
	public Condition<Integer> applyQuantity() {
		this.applyQuantityCondition = new Condition<>();
		return this.applyQuantityCondition;
	}

	/**
	 * 获取申请数量查询条件
	 *
	 * @return applyQuantityCondition 申请数量查询条件
	 */
	public Condition<Integer> getApplyQuantityCondition() {
		return applyQuantityCondition;
	}

	/**
	 * 设置申请数量查询条件
	 *
	 * @param applyQuantityCondition 申请数量查询条件
	 */
	public void setApplyQuantityCondition(Condition<Integer> applyQuantityCondition) {
		this.applyQuantityCondition = applyQuantityCondition;
	}

	/**
	 * 构造并返回审核数量查询条件
	 *
	 * @return checkQuantityCondition 审核数量查询条件
	 */
	public Condition<Integer> checkQuantity() {
		this.checkQuantityCondition = new Condition<>();
		return this.checkQuantityCondition;
	}

	/**
	 * 获取审核数量查询条件
	 *
	 * @return checkQuantityCondition 审核数量查询条件
	 */
	public Condition<Integer> getCheckQuantityCondition() {
		return checkQuantityCondition;
	}

	/**
	 * 设置审核数量查询条件
	 *
	 * @param checkQuantityCondition 审核数量查询条件
	 */
	public void setCheckQuantityCondition(Condition<Integer> checkQuantityCondition) {
		this.checkQuantityCondition = checkQuantityCondition;
	}

	/**
	 * 构造并返回发放数量查询条件
	 *
	 * @return releasedQuantityCondition 发放数量查询条件
	 */
	public Condition<Integer> releasedQuantity() {
		this.releasedQuantityCondition = new Condition<>();
		return this.releasedQuantityCondition;
	}

	/**
	 * 获取发放数量查询条件
	 *
	 * @return releasedQuantityCondition 发放数量查询条件
	 */
	public Condition<Integer> getReleasedQuantityCondition() {
		return releasedQuantityCondition;
	}

	/**
	 * 设置发放数量查询条件
	 *
	 * @param releasedQuantityCondition 发放数量查询条件
	 */
	public void setReleasedQuantityCondition(Condition<Integer> releasedQuantityCondition) {
		this.releasedQuantityCondition = releasedQuantityCondition;
	}

	/**
	 * 构造并返回申请有效日期开始查询条件
	 *
	 * @return startTimeCondition 申请有效日期开始查询条件
	 */
	public Condition<LocalDateTime> startTime() {
		this.startTimeCondition = new Condition<>();
		return this.startTimeCondition;
	}

	/**
	 * 获取申请有效日期开始查询条件
	 *
	 * @return startTimeCondition 申请有效日期开始查询条件
	 */
	public Condition<LocalDateTime> getStartTimeCondition() {
		return startTimeCondition;
	}

	/**
	 * 设置申请有效日期开始查询条件
	 *
	 * @param startTimeCondition 申请有效日期开始查询条件
	 */
	public void setStartTimeCondition(Condition<LocalDateTime> startTimeCondition) {
		this.startTimeCondition = startTimeCondition;
	}

	/**
	 * 构造并返回申请有效日期结束查询条件
	 *
	 * @return endTimeCondition 申请有效日期结束查询条件
	 */
	public Condition<LocalDateTime> endTime() {
		this.endTimeCondition = new Condition<>();
		return this.endTimeCondition;
	}

	/**
	 * 获取申请有效日期结束查询条件
	 *
	 * @return endTimeCondition 申请有效日期结束查询条件
	 */
	public Condition<LocalDateTime> getEndTimeCondition() {
		return endTimeCondition;
	}

	/**
	 * 设置申请有效日期结束查询条件
	 *
	 * @param endTimeCondition 申请有效日期结束查询条件
	 */
	public void setEndTimeCondition(Condition<LocalDateTime> endTimeCondition) {
		this.endTimeCondition = endTimeCondition;
	}

	/**
	 * 构造并返回[枚举]审核状态：0-未审核-READY、1-审核中-CHECKING、2-已通过-PASSED、3-审核未通过-UNPASSED、5-已失效-INVALID查询条件
	 *
	 * @return checkedStatusCondition [枚举]审核状态：0-未审核-READY、1-审核中-CHECKING、2-已通过-PASSED、3-审核未通过-UNPASSED、5-已失效-INVALID查询条件
	 */
	public Condition<CoupApplyCheckedStatus> checkedStatus() {
		this.checkedStatusCondition = new Condition<>();
		return this.checkedStatusCondition;
	}

	/**
	 * 获取[枚举]审核状态：0-未审核-READY、1-审核中-CHECKING、2-已通过-PASSED、3-审核未通过-UNPASSED、5-已失效-INVALID查询条件
	 *
	 * @return checkedStatusCondition [枚举]审核状态：0-未审核-READY、1-审核中-CHECKING、2-已通过-PASSED、3-审核未通过-UNPASSED、5-已失效-INVALID查询条件
	 */
	public Condition<CoupApplyCheckedStatus> getCheckedStatusCondition() {
		return checkedStatusCondition;
	}

	/**
	 * 设置[枚举]审核状态：0-未审核-READY、1-审核中-CHECKING、2-已通过-PASSED、3-审核未通过-UNPASSED、5-已失效-INVALID查询条件
	 *
	 * @param checkedStatusCondition [枚举]审核状态：0-未审核-READY、1-审核中-CHECKING、2-已通过-PASSED、3-审核未通过-UNPASSED、5-已失效-INVALID查询条件
	 */
	public void setCheckedStatusCondition(Condition<CoupApplyCheckedStatus> checkedStatusCondition) {
		this.checkedStatusCondition = checkedStatusCondition;
	}

	/**
	 * 构造并返回审核有效日期开始查询条件
	 *
	 * @return checkStartTimeCondition 审核有效日期开始查询条件
	 */
	public Condition<LocalDateTime> checkStartTime() {
		this.checkStartTimeCondition = new Condition<>();
		return this.checkStartTimeCondition;
	}

	/**
	 * 获取审核有效日期开始查询条件
	 *
	 * @return checkStartTimeCondition 审核有效日期开始查询条件
	 */
	public Condition<LocalDateTime> getCheckStartTimeCondition() {
		return checkStartTimeCondition;
	}

	/**
	 * 设置审核有效日期开始查询条件
	 *
	 * @param checkStartTimeCondition 审核有效日期开始查询条件
	 */
	public void setCheckStartTimeCondition(Condition<LocalDateTime> checkStartTimeCondition) {
		this.checkStartTimeCondition = checkStartTimeCondition;
	}

	/**
	 * 构造并返回审核有效日期结束查询条件
	 *
	 * @return checkEndTimeCondition 审核有效日期结束查询条件
	 */
	public Condition<LocalDateTime> checkEndTime() {
		this.checkEndTimeCondition = new Condition<>();
		return this.checkEndTimeCondition;
	}

	/**
	 * 获取审核有效日期结束查询条件
	 *
	 * @return checkEndTimeCondition 审核有效日期结束查询条件
	 */
	public Condition<LocalDateTime> getCheckEndTimeCondition() {
		return checkEndTimeCondition;
	}

	/**
	 * 设置审核有效日期结束查询条件
	 *
	 * @param checkEndTimeCondition 审核有效日期结束查询条件
	 */
	public void setCheckEndTimeCondition(Condition<LocalDateTime> checkEndTimeCondition) {
		this.checkEndTimeCondition = checkEndTimeCondition;
	}

	/**
	 * 构造并返回版本查询条件
	 *
	 * @return versionCondition 版本查询条件
	 */
	public Condition<Integer> version() {
		this.versionCondition = new Condition<>();
		return this.versionCondition;
	}

	/**
	 * 获取版本查询条件
	 *
	 * @return versionCondition 版本查询条件
	 */
	public Condition<Integer> getVersionCondition() {
		return versionCondition;
	}

	/**
	 * 设置版本查询条件
	 *
	 * @param versionCondition 版本查询条件
	 */
	public void setVersionCondition(Condition<Integer> versionCondition) {
		this.versionCondition = versionCondition;
	}

	/**
	 * 构造并返回创建时间查询条件
	 *
	 * @return createdTimeCondition 创建时间查询条件
	 */
	public Condition<LocalDateTime> createdTime() {
		this.createdTimeCondition = new Condition<>();
		return this.createdTimeCondition;
	}

	/**
	 * 获取创建时间查询条件
	 *
	 * @return createdTimeCondition 创建时间查询条件
	 */
	public Condition<LocalDateTime> getCreatedTimeCondition() {
		return createdTimeCondition;
	}

	/**
	 * 设置创建时间查询条件
	 *
	 * @param createdTimeCondition 创建时间查询条件
	 */
	public void setCreatedTimeCondition(Condition<LocalDateTime> createdTimeCondition) {
		this.createdTimeCondition = createdTimeCondition;
	}

	/**
	 * 构造并返回查询条件
	 *
	 * @return createdByCondition 查询条件
	 */
	public Condition<String> createdBy() {
		this.createdByCondition = new Condition<>();
		return this.createdByCondition;
	}

	/**
	 * 获取查询条件
	 *
	 * @return createdByCondition 查询条件
	 */
	public Condition<String> getCreatedByCondition() {
		return createdByCondition;
	}

	/**
	 * 设置查询条件
	 *
	 * @param createdByCondition 查询条件
	 */
	public void setCreatedByCondition(Condition<String> createdByCondition) {
		this.createdByCondition = createdByCondition;
	}

	/**
	 * 构造并返回是否删除（1：已删除，0：未删除）查询条件
	 *
	 * @return delCondition 是否删除（1：已删除，0：未删除）查询条件
	 */
	public Condition<Boolean> del() {
		this.delCondition = new Condition<>();
		return this.delCondition;
	}

	/**
	 * 获取是否删除（1：已删除，0：未删除）查询条件
	 *
	 * @return delCondition 是否删除（1：已删除，0：未删除）查询条件
	 */
	public Condition<Boolean> getDelCondition() {
		return delCondition;
	}

	/**
	 * 设置是否删除（1：已删除，0：未删除）查询条件
	 *
	 * @param delCondition 是否删除（1：已删除，0：未删除）查询条件
	 */
	public void setDelCondition(Condition<Boolean> delCondition) {
		this.delCondition = delCondition;
	}

	/**
	 * 构造并返回删除时间查询条件
	 *
	 * @return delTimeCondition 删除时间查询条件
	 */
	public Condition<LocalDateTime> delTime() {
		this.delTimeCondition = new Condition<>();
		return this.delTimeCondition;
	}

	/**
	 * 获取删除时间查询条件
	 *
	 * @return delTimeCondition 删除时间查询条件
	 */
	public Condition<LocalDateTime> getDelTimeCondition() {
		return delTimeCondition;
	}

	/**
	 * 设置删除时间查询条件
	 *
	 * @param delTimeCondition 删除时间查询条件
	 */
	public void setDelTimeCondition(Condition<LocalDateTime> delTimeCondition) {
		this.delTimeCondition = delTimeCondition;
	}

}
